//
//  ZLPRankTableViewCell.m
//  TangYi
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 赵连鹏. All rights reserved.
//

#import "ZLPRankTableViewCell.h"

@implementation ZLPRankTableViewCell

- (void)dealloc {
    [_rankLabel release];
    [_nameLabel release];
    [_part_in_rate release];
    [_avatar release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void) createView {
    self.rankLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.rankLabel];
    [_rankLabel release];
    
    self.nameLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.nameLabel];
    [_nameLabel release];
    
    self.part_in_rate = [[UILabel alloc] init];
    [self.contentView addSubview:self.part_in_rate];
    [_part_in_rate release];
    
    self.avatar = [[UIImageView alloc] init];
    [self.contentView addSubview:self.avatar];
    [_avatar release];
    
//    self.button = [UIButton buttonWithType:UIButtonTypeCustom];
//    [self.contentView addSubview:self.button];
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.rankLabel.frame = CGRectMake(5, 10, 30, self.contentView.frame.size.height);
    self.rankLabel.textColor = [UIColor redColor];
    self.rankLabel.font = [UIFont systemFontOfSize:20];
    self.avatar.frame = CGRectMake(30, 5, self.contentView.frame.size.height - 10, self.contentView.frame.size.height - 10);
    self.nameLabel.frame = CGRectMake(30 + self.contentView.frame.size.height, 5, self.contentView.frame.size.width - self.contentView.frame.size.height - 70, self.contentView.frame.size.height / 3);
    self.part_in_rate.frame = CGRectMake(30 + self.contentView.frame.size.height, 20 + self.contentView.frame.size.height / 3, self.contentView.frame.size.width - 70, self.contentView.frame.size.height / 3);
//    self.button.frame = CGRectMake(self.contentView.frame.size.width - 90, self.contentView.frame.size.height / 2 - 15, 80, 30);
//    self.button.layer.borderWidth = 1;
//    self.button.layer.cornerRadius = 15;
//    [self.button setTitle:@"关注" forState:UIControlStateNormal];
//    [self.button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//    [self.button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
}

//- (void)click:(UIButton *)button {
//    NSLog(@"被点击了!");
//    if (self.isClicked == NO) {
//        [self.button setTitle:@"已关注" forState:UIControlStateNormal];
//    } else {
//        [self.button setTitle:@"关注" forState:UIControlStateNormal];
//    }
//    self.isClicked = !self.isClicked;
//}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
